package com.doit.day03

object _02_可迭代的 {
  def main(args: Array[String]): Unit = {

   /* val iterable: MyScalaIterable = new MyScalaIterable
    val iterator: Iterator[ScalaHero] = iterable.iterator
    for (elem <- iterator) {
      println(elem)
    }*/
  }


}


/**
 *  extends ==> 继承父类的时候才用   java中是单继承多实现   scala中也是单继承多实现
 */
/*class MyScalaIterable extends Iterable[ScalaHero] with Iterator[ScalaHero]{

  override def iterator: Iterator[ScalaHero] = new MyScalaIterator

  override def hasNext: Boolean = ???

  override def next(): ScalaHero = ???

}*/

class Fu

//如果有父类  父类继承用extends 后面的接口都用with
//如果没有父类，直接就是接口  第一个用extends 后面全部用with
class Zi extends Fu with Iterable[ScalaHero] {
  override def iterator: Iterator[ScalaHero] = ???
}

